﻿using System.Collections.ObjectModel;
using System.Linq;

namespace LightCAD.Core
{
 
    public class LcComponent : LcObject
    {
        public string Uuid { get; set; }
        public string Name { get; set; }//例如：SingleDoor45
        public string DisplayName { get; set; }//例如：单扇平开门_半开
        public string Category { get; set; }//例如：Door
        public string SubCategory { get; set; }//例如：SwingDoor
        public string Description { get; set; }

        //public PluginDefinition PluginDef { get; set; }
        //public PropertyDefinitionCollection ArgsDef { get; set; }

        public ComponentShape2d Shape2D { get; set; }

    }
    public class ComponentCollection : KeyedCollection<string, LcComponent>
    {
        protected override string GetKeyForItem(LcComponent item)
        {
            return item.Uuid;
        }

        public LcComponent Find(string category, string name)
        {
            return this.FirstOrDefault(item => item.Category == category && item.Name == name);
        }
    }







}